<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>新增文章</title>
	<link type="text/css" rel="stylesheet" href="<?php echo base_url() ?>public/css/style.css" />
	<script type="text/javascript" src="<?php echo base_url() ?>public/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript">
		window.UEDITOR_HOME_URL = "<?php echo base_url() ?>public/ueditor/";
		window.onload = function(){
			window.UEDITOR_CONFIG.initialFrameWidth = 900;
			window.UEDITOR_CONFIG.initialFrameHeight = 600;
			UE.getEditor('content');
		}
	</script>
	<script type="text/javascript" src="<?php echo base_url() ?>public/ueditor/ueditor.config.js"></script>
</head>

<body>
<div class="wrapper">
<?php echo validation_errors(); ?>
<?php echo form_open_multipart('/article/add'); ?>
	<p class="p-item"><label class="lab-item">标题：</label><input type="text" class="txt" id="title" name="title" /></p>
	<p class="p-item"><label class="lab-item">缩微图：</label><input type="file" class="txt" name="thumb"/></p>
	<p class="p-item"><label class="lab-item">正文：</label><textarea id="content" name="content" style="width:550px;height:500px;"></textarea>
	<?php echo form_error('content', '<span>', '</span>') ?></p>
	<p class="p-btn"><input name="botton_submit" class="btn-sub" type="submit" /></p>
</form>
</div>
<script type="text/javascript" src="<?php echo base_url() ?>public/js/jquery.min.js"></script>
<script type="text/javascript">
$.ajax({
	url:'<?php echo base_url() ?>article/json',
	type : 'get',
	success : function (data) {
		var data = eval('('+data+')');
		window.console && console.log(data);
	}
});

// $('.btn-sub').click(function() {
// 	var data = {
// 		title:$('#title').val(),
// 		content : $('#content').val()
// 	}
// 	$.post('/article/addDo',data,function (data) {
// 		window.console && console.log(data);
// 	});
// 	return false;
// });

</script>
</body>
</html>